home *** CD-ROM | disk | FTP | other *** search
- Path: news.sprintlink.net!datalytics!usenet
- From: Rob Stewart <stew@datalytics.com>
- Newsgroups: comp.lang.c++
- Subject: Re: easy c++ question
- Date: Wed, 10 Apr 1996 16:26:24 -0400
- Organization: Datalytics, Inc
- Message-ID: <316C1970.67F7@datalytics.com>
- References: <316901DA.3138C677@ablecom.net> <4kgnd8$5hp@sun0.urz.uni-heidelberg.de>
- NNTP-Posting-Host: 204.62.224.71
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Paul Starzetz wrote:
- >
- > In article 3138C677@ablecom.net, The Letter O <jczech@ablecom.net> writes:
- >
- > class stack {
- > > private:
- > > int count; // number of items in the stack
- > > int data[100]; // the items themselves
- > > public:
- > > .
- > >inline stack::stack(void)
- > >{
- > > count = 0; // zero the stack
- > > cout << "constructor has been called\n";
- > >}
- > >//==============================================
- > >
- > try to flush the output stream, otherwise you will not see anything!
- > I have some Unix experience and have already encoutered this problem.
- > Try:
- >
- > #include <iomanip.h>
- >
- > inline stack::stack(void)
- > {
- > count = 0; // zero the stack
- > cout << "constructor has been called\n";
- > cout << flush;
-
- Why are you going to this trouble? If you need a newline and a
- call to flush, use endl:
-
- cout << "in stack::stack" << endl;
-
- BTW, note that I made the diagnostic a little more useful by
- including the class and function name.
-
- > }
- >
- > ...otherwise use another compiler !!!
-
- --
- Robert Stewart | My opinions are usually my own.
- Datalytics, Inc. | stew@datalytics.com
-